﻿using System.Collections.Generic;
using System.Linq;
using DTD.Repositories.Interfaces;

namespace DTD.Repositories
{
    public class UserRepository: RepositoryBase, IUserRepository
    {
        public List<User> GetAllUsers()
        {
            return dataContext.Users.ToList();
        }

        public User GetById(int Id)
        {
            return dataContext.Users.Where(u => u.Id == Id).SingleOrDefault();
        }

        public void Create(User user)
        {
            dataContext.Users.InsertOnSubmit(user);
            dataContext.SubmitChanges();
        }
    }
}